Entity-Relationship Model

The Entity-Relationship Model in Database Management System.

Table of Contents

1. Takeaways

Item Notation
Entity Set Rectangle
Weak Entity Set Double Rectangle
Attribute Ellipse
Multi-valued Attributes Double Ellipse
Derived Attributes Dashed Ellipse
Relationship Set Diamond
Identifying Relationship Set Double Diamonds
Primary Key Underline
Discriminator Dash line
Cardinality Notation
One Arrow
Many No Arrow
Total participation (All Must) Double Line
Partial participation (Some may) Single Line
Specialization (ISA triangle) Notation
Disjoint Annotate “disjoint”
Overlapping No annotation

2. Fundamental Concepts

Entity
is an object that exists and is distinguishable from other objects. Represented by a rectangle in the E-R diagram.
Entity Set
A set of entities that has the same type and share the same properties.
Attribute
Represented by an ellipse in E-R diagram.
Relationship
An association among entities.
Relationship
A set of relationship of the same type. Represented by diamonds.

3. Constraints

Mapping Cardinalities
Concerns the number of entities to which another entities can be associated via a relationship set
Participation Constraints
Concerns whether all entities in the entity set have to participate in the relationship set.

To indicate mapping cardinality, draw a directed arrow \(\to\) signifying one between the relationship set and the entity; draw an undirected line \(-\) signifying many between the relationship set and the entity.

To indicate participation constraints, use double line to indicate total participation (all entity must do); use single line to indicate partial participation.

4. Keys

Keys are used to determine an entity bby attributes.

Super Key
A set of one or more attributes whose values uniquely determine each entity.
Candidate Key
A minimal1 super key.
Primary Key
One of the candidate keys is selected to be the primary key. Underline the attribute to indicate the primary key

5. Weak Entity Set

Weak Entity Set
refers to entity sets whose attributes are not sufficient to form a primary key to uniquely identify each entity. Denoted by double triangles in diagrams.

Therefore, weak entity set depends on other entity sets to identify its own entities. The entity sets that weak entity sets depends on are called identifying entity sets.

To connect weak entity sets to their identifying entity sets, we should involve identifying relationship set, denoted by double diamonds. The relationship between weak and identifying entity sets must be total and many-to-one or one-to-one.

For a weak entity set, the primary key is formed by the primary key of the identifying entity set plus the discriminator of the weak entity set. The discriminator is denoted by dashed line.

6. Role

Roles
The labels are called roles, as they specify how these entity sets interact via relationship sets.
Specialization
Specialization is to designate subgroupings within an entity set that are distinctive from other entities in this set. Denoted by a “IS A” triangle in the E-R Diagram.

For specialization, lower-level entities automatically inherits all attributes and relationship set participation of higher-level entity set to which it’s linked. Moreover, they can have their own attributes.

  • Completeness Constraints:
    Total specialization
    An entity in a higher-level entity set must belong to at least one of the lower-level entity sets within a specialization. Denoted by double line in ISA diagram.
    Partial specialization
    An entity in a higher-level entity set may not belong to any lower-level entity sets within the specialization. Denoted by single line in ISA diagram.
  • Disjointness Constraints:
    Disjoint specialization
    Entities may only belong to no more than one lower-level entity sets. Denoted by a keyword “disjoint” in the diagram.
    Overlapping specialization
    Entities may belong to more than one lower-level entity sets. Does not require any keyword notations.

7. Different Attribute Types

Single vs. Composite Attributes
A composite attribute can be further decomposed into several single attributes, called component attributes.
Single-valued vs. Multi-valued Attributes
Multi-valued attributes can have multiple values on an attribute (e.g., multiple phone numbers on the “phone” attribute). Multi-valued attribute is denoted by double ellipse.
Derived Attributes
The value in derived attributes can be derived from other attributes, e.g., “age” can be computed from “dateofbirth”. Denoted by dashed ellipse.

8. E-R Design Decision

Some common design principles:

  • Use relationship sets to describe an action that occurs between entities.

9. Converting E-R Diagrams to Relational Tables

9.1. Regular Entity Sets and Attributes

An entity set can be reduced to a table with the same attributes. E.g., schema customer(id, name, address).

Composite attributes are flattened out by creating a seperate attribute for each component attribute.

A multi-valued attribute \(M\) of an entity set \(E\) is represented by a separate table \(EM\), with primary key of \(E\) as one of \(EM\)’s attribute.

9.2. Weak Entity Set

A weak entity set becomes a table that includes the columns for the primary key of the identifying entity set.

9.3. Regular Relationship Set

The reduction depends on mapping cardinality, i.e., many-to-many, one-to-many, many-to-one, one-to-one.

A many-to-many relationship set is a table with columns for the primary keys of the participating entity sets, and any attributes of the relationship set.

A many-to-one or one-to-many can be represented by adding extra attributes to the “many”-side, containing the primary key of the “one”-side.

For one-to-one relationship sets, either side can be chosen to act as the “many”-side.

9.4. Specialization

Method 1. Form a table from the higher-level entity set. Then, for each lower-level entity set, which contains the primary key of the higher-level entity set and local attributes.

Method 2. Form a table for each entity with all local and inherited attributes. If the specialization is total, then the table for higher-level entity set can be removed.

9.5. Foreign Key

A foreign key is a referential constraint between two tables. The foreign key is a field(s) in a relational table that matches a candidate key of another table, and can be used to cross-reference tables.

Footnotes:

1

minimal means no redundant attributes, i.e., any subset of a candidate key cannot be a key

Date: 2026-09-24 Thu

Author: ArcaLunar